package com.mkz.storage.feign;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.mkz.core.common.util.ResponseResult;
import com.mkz.storage.service.StorageService;

import lombok.AllArgsConstructor;

@RestController
@AllArgsConstructor
public class IStorageClient implements StorageClient {
	private final StorageService storageService;
	
	@Override
	@PostMapping("deduct")
	public ResponseResult<Boolean> deduct(@RequestParam String commodityCode, @RequestParam Integer count) {
		boolean dealResult = storageService.deduct(commodityCode, count);
		if(!dealResult) {
			ResponseResult.failed("处理失败！");
		}
		return ResponseResult.ok(true);
	}
	
}
